﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BasePlatformCommon;
using BasePlatformNet;

namespace L9SubSet {
    public partial class Form_LampSet : Form {
        BaseCoreNet core;
        private string section = "LampSet";
        public Form_LampSet(BaseCoreNet core) {
            InitializeComponent();
            this.core = core;
            if (LanguageOper.available) {
                setLanguageText();
            }
        }

        private void btnCascade_Click(object sender, EventArgs e) {
            var type = rdoSerial.Checked ? 0 : 1;
            core.setLampCascade(1, 1, -1, (byte)type);
        }

        private void btnPinSet_Click(object sender, EventArgs e) {
            var type = rdoPWM1.Checked ? 1 : 0;
            core.setLampPWMPin(1, 1, -1, (byte)type);
        }

        public void setLanguageText() {
            this.Text = LanguageOper.ReadValue(section, "LampSet.Text");
            grpCascade.Text = LanguageOper.ReadValue(section, "grpCascade.Text");
            rdoSerial.Text = LanguageOper.ReadValue(section, "rdoSerial.Text");
            rdoIO.Text = LanguageOper.ReadValue(section, "rdoIO.Text");
            btnCascade.Text = LanguageOper.ReadValue(section, "btnCascade.Text");
            grpPinSet.Text = LanguageOper.ReadValue(section, "grpPinSet.Text");
            btnPinSet.Text = LanguageOper.ReadValue(section, "btnPinSet.Text");
        }
    }
}
